import Cookies from 'js-cookie';

const TokenKey = 'Admin-Token';

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token) {
  return Cookies.set(TokenKey, token);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}

const UserLoginType = 'User-Login-Type';
export function getUserLoginType() {
  return Cookies.get(UserLoginType);
}

export function setUserLoginType(token) {
  return Cookies.set(UserLoginType, token);
}

export function removeUserLoginType() {
  return Cookies.remove(UserLoginType);
}

const SysUserInfoKey = 'Sys-User-Info';
export function getSysUserInfo() {
  return localStorage.getItem(SysUserInfoKey);
}

export function setSysUserInfo(user) {
  return localStorage.setItem(SysUserInfoKey, user);
}

export function removeSysUserInfo() {
  return localStorage.removeItem(SysUserInfoKey);
}

export function removeAll() {
  removeUserLoginType();
  removeLoginUserInfo();
  removeSysUserInfo();
  removeToken();
}
